<template>
  <div class="resource-main-box new-page event-code-maintenance">
    <a-form-model
      layout="inline"
      :model="search"
      class="comm-search-f new-page-vm"
      :style="`width: calc(100% - ${sideMenuWidth} - 33px)`"
    >
      <!-- 筛选条件与查询 -->
      <a-form-model-item label="">
        <airModel v-model="search.aircraftType" width="100%" />
      </a-form-model-item>
      <a-form-model-item label="">
        <a-input v-model="search.errorCode" placeholder="事件代码" />
      </a-form-model-item>
      <a-form-model-item label="">
        <a-input v-model="search.errorName" placeholder="事件名称" />
      </a-form-model-item>

      <a-form-model-item label="">
        <eventList
          v-model="search.errorType"
          :mul="true"
          placeholder="事件类型"
          width="100%"
        />
      </a-form-model-item>
      <a-form-model-item label="">
        <ataList v-model="search.ataCode" mode="default" width="100%" />
        <!-- <a-input v-model="search.ataCode" style="width:100%" placeholder="请输入ATA" /> -->
      </a-form-model-item>
      <a-form-model-item label="">
        <a-select
          v-model="search.upload"
          show-arrow
          allow-clear
          style="minwidth: 100%"
          placeholder="是否包含上传文件"
        >
          <a-icon
            slot="suffixIcon"
            :component="require('@/assets/icon/arrow-down-bold.svg')"
          />
          <a-select-option
            v-for="selectItem in uploadArr"
            :key="selectItem.value"
            :value="selectItem.value"
          >
            {{ selectItem.label }}
          </a-select-option>
        </a-select>
      </a-form-model-item>
      <a-form-model-item label="">
        <a-select
          v-model="search.isEtops"
          show-arrow
          allow-clear
          style="minwidth: 100%"
          placeholder="ETOPS"
        >
          <a-icon
            slot="suffixIcon"
            :component="require('@/assets/icon/arrow-down-bold.svg')"
          />
          <a-select-option
            v-for="selectItem in uploadArr"
            :key="selectItem.value"
            :value="selectItem.value"
          >
            {{ selectItem.label }}
          </a-select-option>
        </a-select>
      </a-form-model-item>
      <a-form-model-item label="">
        <a-select
          v-model="search.isOtherItem"
          show-arrow
          allow-clear
          style="minwidth: 100%"
          placeholder="Other item"
        >
          <a-icon
            slot="suffixIcon"
            :component="require('@/assets/icon/arrow-down-bold.svg')"
          />
          <a-select-option
            v-for="selectItem in uploadArr"
            :key="selectItem.value"
            :value="selectItem.value"
          >
            {{ selectItem.label }}
          </a-select-option>
        </a-select>
      </a-form-model-item>
      <a-form-model-item label="">
        <a-select
          v-model="search.airPriority"
          show-arrow
          allow-clear
          style="minwidth: 100%"
          placeholder="是否包含航空公司优先级"
        >
          <a-icon
            slot="suffixIcon"
            :component="require('@/assets/icon/arrow-down-bold.svg')"
          />
          <a-select-option
            v-for="selectItem in uploadArr"
            :key="selectItem.value"
            :value="selectItem.value"
          >
            {{ selectItem.label }}
          </a-select-option>
        </a-select>
      </a-form-model-item>
      <a-form-model-item
        style="
          flex: 1 !important;
          max-width: 100% !important;
          min-width: 196px !important;
        "
      >
        <a-button
          type="primary"
          ghost
          :loading="eventMaintenanceLoading"
          @click="resetSearchHandler"
        >
          重置
        </a-button>
        <a-button
          type="primary"
          class="ml-12"
          :loading="eventMaintenanceLoading"
          @click="getData"
        >
          查询
        </a-button>
      </a-form-model-item>
    </a-form-model>
    <!-- table -->

    <div>
      <!-- <a-popover
        title="筛选条件"
        :visible="standScoreVisiable"
        trigger="click"
        placement="bottomLeft"
        @visibleChange="handleClickChange"
      >
        <template slot="content">

          <a-divider class="mt-12 mb-12" />

        </template>

      </a-popover> -->
      <div class="pt-16 pl-16 pr-16 pb-16">
        <a-button ghost type="primary" @click="handleClickChange">
          全局维护
        </a-button>
        <a-button
          type="primary"
          class="ml-12"
          ghost
          :loading="eventMaintenanceLoading"
          @click="addVisible = true"
        >
          添加
        </a-button>

        <a-upload :file-list="[]" :before-upload="beforeUpload">
          <a-button type="primary" class="ml-12" ghost :loading="uploadLoading">
            上传
          </a-button>
        </a-upload>
      </div>
      <a-table
        class=""
        :columns="columns"
        size="middle"
        :data-source="eventMaintenanceList"
        :row-key="(row, index) => row.id"
        :pagination="{
          showTotal: (total) => `共 ${total} 条数据`,
          showSizeChanger: true, //设置每页显示数据条数
          showQuickJumper: true,
          size: 'big',
          current: paginationOptions.pageNum,
          pageSize: paginationOptions.pageSize,
          total: paginationOptions.total
        }"
        :loading="eventMaintenanceLoading"
        :row-class-name="rowClassHandler"
        @change="changeTable"
      />
    </div>

    <!-- 全局维护 width="330"-->
    <a-modal
      v-model="standScoreVisiable"
      :mask-closable="false"
      title=""
      :width="330"
      centered
      :dialog-style="{ height: '380px' }"
      class="rt-i-modal"
      :confirm-loading="getStandScoreListLoading"
      @ok="standScoreSave"
    >
      <span
        slot="closeIcon"
        class="c-dialog-close-icon"
      ><a-icon
        :component="require('@/assets/icon/close.svg')"
      /></span>

      <div class="c-dialog-title fw-500">全局维护</div>

      <div slot="footer">
        <div class="d-flex jc-end mr-8">
          <a-button
            type="default"
            ghost
            :loading="getStandScoreListLoading"
            @click="getStandScoreList"
          >恢复初始值</a-button>
          <a-button
            type="primary"
            :loading="getStandScoreListLoading"
            @click="standScoreSave"
          >保存</a-button>
        </div>
      </div>
      <a-form-model
        ref="addForm"
        :model="addGlobalForm"
        class="ecm-qj-box d-flex flex-column"
      >
        <!-- 按照低中高排序，通过css 修改样式的排序 -->

        <template v-for="(it, i) in 3">
          <a-row :key="i" :class="`ecm-qj-item-${i}`">
            <a-col :span="24">
              <a-form-model-item
                v-for="(item, index) in priorityList"
                v-if="i === index"
                :key="item.value"
                :prop="`score${index}`"
              >
                <a-icon
                  :component="item.icon"
                  style="font-size: 28px; vertical-align: middle"
                />
                {{ item.name }}

                <a-input-number
                  v-if="standScoreListF[index]"
                  :value="standScoreListF[index].score"
                  class="ecm-qj-item-iput input-type-o"
                  :min="0"
                  :max="
                    standScoreListF[index + 1]
                      ? standScoreListF[index + 1].score - 1
                      : Infinity
                  "
                  @change="(e) => changeStandScoreList(e, index)"
                />
              </a-form-model-item>
            </a-col>
            <!-- <a-col :span="4">
              <template v-for="(v1, i1) in 3">
                <template v-if="i === i1">
                  <a-checkbox

                    v-if="standScoreListF[i1]"
                    :key="i1"
                    :checked="standScoreListF[i1].silence != 0"
                    @change="onChange($event, i1)"
                  >
                    静默
                  </a-checkbox>
                </template>
              </template>
            </a-col> -->
            <a-col :span="10" v-if="false">
              <template v-for="(v1, i1) in 3">
                <template v-if="i === i1">
                  <a-select
                    v-if="standScoreListF[i1]"
                    :key="i1"
                    v-model="standScoreListF[i1].ringstone"
                  >
                    <a-select-option
                      key="1"
                      value="alert1"
                    >警报1</a-select-option>
                    <a-select-option
                      key="2"
                      value="alert2"
                    >警报2</a-select-option>
                    <a-select-option
                      key="3"
                      value="alert3"
                    >警报3</a-select-option>
                    <a-select-option
                      key="4"
                      value="alert4"
                    >警报4</a-select-option>
                    <template v-for="v in ringstoneList">
                         <a-select-option
                            :key="v.id"
                            value="v.id"
                          >{{v.fileName}}</a-select-option>
                    </template>
                  </a-select>
                </template>
              </template>
            </a-col>
          </a-row>
        </template>

        <!-- <a-form-model-item
          v-for="(item, index) in priorityList"
          :key="item.value"
          :class="`ecm-qj-item-${index}`"
          :prop="`score${index}`"
        >
          <a-icon
            :component="item.icon"
            style="font-size:28px;vertical-align: middle;"
          />
          {{ item.name }}

          <a-input-number
            v-if="standScoreListF[index]"
            :value="standScoreListF[index].score"
            class="ecm-qj-item-iput input-type-o"
            :min="0"
            :max="
              standScoreListF[index + 1]
                ? standScoreListF[index + 1].score - 1
                : Infinity
            "
            @change="e => changeStandScoreList(e, index)"
          />
        </a-form-model-item> -->
      </a-form-model>
    </a-modal>

    <!-- add -->
    <a-modal
      v-model="addVisible"
      :mask-closable="false"
      title=""
      :width="514"
      :dialog-style="{ height: '715px' }"
      class="rt-i-modal"
      :confirm-loading="addEventMaintenanceLoading"
      @ok="addConfirmHandler"
      @cancel="cancelHandler"
    >
      <span
        slot="closeIcon"
        class="c-dialog-close-icon"
      ><a-icon
        :component="require('@/assets/icon/close.svg')"
      /></span>

      <div class="c-dialog-title fw-500">{{ addTitle }}</div>
      <a-form-model
        ref="addForm"
        :model="addForm"
        :rules="addRules"
        layout="horizontal"
      >
        <a-form-model-item label="故障代码" prop="code">
          <a-input
            v-model="addForm.code"
            placeholder="故障代码"
            class="input-type-o"
            style="width: 100%"
          />
        </a-form-model-item>

        <a-form-model-item label="机型" prop="model">
          <airModel v-model="addForm.model" class="input-type-o" />
        </a-form-model-item>

        <a-form-model-item label="故障类型" prop="faultType">
          <eventList
            v-model="addForm.faultType"
            placeholder="故障类型"
            class="input-type-o"
            style="width: 100%"
          />
        </a-form-model-item>

        <a-form-model-item label="故障名称" prop="faultName">
          <a-input
            v-model="addForm.faultName"
            style="width: 100%"
            class="input-type-o"
            placeholder="故障名称"
          />
        </a-form-model-item>

        <a-form-model-item prop="faultDescription">
          <span
            slot="label"
          >故障描述<span class="text-color-9ea5b2 fs-12">选填</span></span>
          <a-input
            v-model="addForm.faultDescription"
            style="width: 100%"
            class="input-type-o"
            placeholder="故障描述"
          />
        </a-form-model-item>

        <a-form-model-item label="系统优先级" prop="score">
          <a-input-number
            v-model="addForm.score"
            placeholder="系统优先级"
            class="input-type-o"
            :min="0"
            style="width: 100%"
          />
        </a-form-model-item>
        <a-form-model-item prop="airPriority">
          <span
            slot="label"
          >航空公司优先级<span
            class="text-color-9ea5b2 fs-12"
          >选填</span></span>
          <a-input-number
            v-model="addForm.airPriority"
            placeholder="航空公司优先级"
            class="input-type-o"
            :min="0"
            style="width: 100%"
          />
        </a-form-model-item>
        <a-form-model-item prop="airlineCompanyDescribe">
          <span
            slot="label"
          >航空公司描述<span class="text-color-9ea5b2 fs-12">选填</span></span>
          <a-input
            v-model="addForm.airlineCompanyDescribe"
            placeholder="航空公司描述"
            class="input-type-o"
            :min="0"
            style="width: 100%"
          />
        </a-form-model-item>
        <a-form-model-item prop="partNumber">
          <span
            slot="label"
          >CMC or LDI Part Number<span
            class="text-color-9ea5b2 fs-12"
          >选填</span></span>
          <a-textarea
            v-model="addForm.partNumber"
            placeholder="CMC or LDI Part Number（多个用中文或英文逗号分隔）"
            :auto-size="{ minRows: 5, maxRows: 8 }"
            class="input-type-o"
            style="width: 100%"
          />
        </a-form-model-item>

        <a-form-model-item label="ETOPS" prop="isEtops">
          <a-radio-group v-model="addForm.isEtops" :default-value="1">
            <a-radio :value="1"> 是 </a-radio>
            <a-radio :value="0"> 否 </a-radio>
          </a-radio-group>
        </a-form-model-item>

        <a-form-model-item prop="uri">
          <span slot="label">
            URL
            <span class="text-color-9ea5b2 fs-12">选填</span>
          </span>
          <a-input
            v-model="addForm.uri"
            placeholder="URL"
            class="input-type-o"
            style="width: 100%"
          />
        </a-form-model-item>
        <a-form-model-item prop="otherItem">
          <span slot="label">
            Other item
            <!-- <span class="text-color-9ea5b2 fs-12">选填</span> -->
          </span>
          <a-select
            v-model="addForm.otherItem"
            class="input-type-o"
            style="width: 100%"
            placeholder="请选择"
          >
            <a-select-option
              v-for="selectItem in isNotOption"
              :key="selectItem.value"
              :value="selectItem.value"
            >
              {{ selectItem.name }}
            </a-select-option>
          </a-select>
        </a-form-model-item>
        <a-form-model-item prop="relatedCode">
          <span
            slot="label"
          >关联的代码<span class="text-color-9ea5b2 fs-12">选填</span></span>
          <a-textarea
            v-model="addForm.relatedCode"
            class="input-type-o"
            style="width: 100%"
            placeholder="内容"
            :auto-size="{ minRows: 5, maxRows: 8 }"
          />
          <!-- <eventCodeList v-model="addForm.relatedCode" class="input-type-o" :max-tag-count="5" value-key="value" name-key="value" /> -->
        </a-form-model-item>
        <a-form-model-item prop="contact">
          <span
            slot="label"
          >Contact<span class="text-color-9ea5b2 fs-12">选填</span></span>
          <a-input
            v-model="addForm.contact"
            placeholder="contact"
            class="input-type-o"
            style="width: 100%"
          />
        </a-form-model-item>
        <a-form-model-item prop="source">
          <span
            slot="label"
          >Source<span class="text-color-9ea5b2 fs-12">选填</span></span>
          <a-input
            v-model="addForm.source"
            placeholder="source"
            class="input-type-o"
            style="width: 100%"
          />
        </a-form-model-item>
        <a-form-model-item prop="file2" class="uload2-out-box">
          <span
            slot="label"
          >文件上传<span class="text-color-9ea5b2 fs-12">选填</span></span>
          <!-- <a-input :value="upload2Data.name" disabled placeholder="上传文件" class="input-type-o" style="width: 100%" /> -->

          <a-upload :file-list="[]" :before-upload="beforeUpload2">
            <a-button type="primary" ghost :loading="upload2Loading">
              上传
            </a-button>
          </a-upload>

          <div class="file-list-box">
            <div
              v-for="(item, index) in upload2Data"
              :key="item + index"
              class="d-flex jc-between"
            >
              <span>
                {{ item.name }}
              </span>

              <div>
                <span class="mr-24">{{ item.time }}</span>
                <a-popconfirm
                  title="确认删除此文件?"
                  ok-type="danger"
                  ok-text="确认"
                  cancel-text="取消"
                  @confirm="delFileItemHandler(item, index)"
                >
                  <a-button class="del-file-btn-box" type="link">
                    删除
                  </a-button>
                </a-popconfirm>
              </div>
            </div>
          </div>
        </a-form-model-item>
      </a-form-model>
    </a-modal>
  </div>
</template>

<script>
import { getRingstoneList } from '@/services/user'
import { mapState, mapActions, mapMutations, mapGetters } from 'vuex';
import rowClass from '@/pages/common/rowClass';
import { priorityList, isNotOption } from '@/pages/common/constant.js';
import eventList from '@/pages/components/eventList';
// import eventCodeList from '@/pages/components/eventCodeList';
import airModel from '@/pages/components/airModel';
import ataList from '@/pages/components/ataList';
export default {
  name: 'EventCodeMaintenance',
  components: {
    eventList,
    ataList,
    // eventCodeList,
    airModel
  },
  mixins: [rowClass],
  data() {
    return {
      ringstoneList:[],
      standScoreVisiable: false,
      addGlobalForm: {},
      search: {},
      fileList: [],
      fileList2: [],
      priorityList,
      isNotOption,
      addVisible: false,
      uploadArr: Object.freeze([
        {
          value: 1,
          label: '是'
        },
        {
          value: 0,
          label: '否'
        }
      ]),
      addForm: {
        isEtops: 1,
        otherItem: 0
      },
      addTitle: '新增新的事件代码',
      addRules: Object.freeze({
        code: [{ required: true, message: '请填写', trigger: 'change' }],
        model: [{ required: true, message: '请填写', trigger: 'change' }],
        otherItem: [{ required: true, message: '请填写', trigger: 'change' }],
        // partNumber: [
        //   { required: true, message: '请填写', trigger: 'change' }
        // ],
        faultType: [{ required: true, message: '请选择', trigger: 'change' }],
        faultName: [{ required: true, message: '请填写', trigger: 'change' }],
        // faultDescription: [
        //   { required: true, message: '请填写', trigger: 'change' }
        // ],
        score: [
          {
            required: true,
            type: 'number',
            message: '请选择',
            trigger: 'change'
          }
        ]
        // uri: [
        //   { required: true, message: '请填写', trigger: 'change' }
        // ]
        // relatedCode: [
        //   { required: true, type: 'array', message: '请选择', trigger: 'change' }
        // ]
      }),
      columns: Object.freeze([
        {
          title: '机型',
          align: 'left',
          dataIndex: 'model',
          customRender: (value) => {
            return value || '--';
          }
        },
        {
          title: '事件代码',
          align: 'left',
          dataIndex: 'code',
          customRender: (value) => {
            return value || '--';
          }
        },
        {
          title: '事件类型',
          align: 'left',
          dataIndex: 'faultType',
          customRender: (value) => {
            return value || '--';
          }
        },
        {
          title: '事件名称',
          align: 'left',
          dataIndex: 'faultName',
          customRender: (value) => {
            return value || '--';
          }
        },
        {
          title: '事件描述',
          align: 'left',
          width: 300,
          dataIndex: 'faultDescription',
          customRender: (value) => {
            return value || '--';
          }
        },
        // {
        //   title: '关联代码',
        //   align: 'left',
        //   width: 200,
        //   dataIndex: 'relatedCode',
        //   customRender: (value) => {
        //     return value || '--';
        //   }
        // },
        {
          title: 'Other item',
          align: 'left',
          dataIndex: 'otherItem',
          customRender: (value) => {
            return value === 0 ? '否' : value === 1 ? '是' : '--';
          }
        },
        // {
        //   title: 'CMC or LDI Part Number',
        //   align: 'left',
        //   width: 200,
        //   dataIndex: 'partNumber',
        //   customRender: (value) => {
        //     return (value && value.length) > 0 ? value.join('，') : '--';
        //   }
        // },
        {
          title: '优先级',
          align: 'left',
          dataIndex: 'score',
          customRender: (value) => {
            return value || '--';
          }
        },
        {
          title: 'ETOPS',
          align: 'left',
          dataIndex: 'isEtops',
          customRender: (value) => {
            return typeof value === 'number' ? (
              value ? (
                <a-icon type='check' />
              ) : (
                <a-icon type='close' />
              )
            ) : (
              '--'
            );
          }
        },
        {
          title: 'URL',
          align: 'left',
          dataIndex: 'uri',
          customRender: (value) => {
            return value || '--';
          }
        },

        {
          title: '操作',
          align: 'left',
          dataIndex: 'option',
          width: 138,
          customRender: (value, record, index) => {
            const { id } = record;
            return [
              <a-button
                type='link'
                onClick={() => this.detailEventHandler(record)}
              >
                详情
              </a-button>,
              <a-popconfirm
                title='确认删除此项?'
                ok-type='danger'
                ok-text='确认'
                cancel-text='取消'
                onConfirm={() => this.delItemHandler(id)}
              >
                <a-button type='link'>删除</a-button>
              </a-popconfirm>
              // <a-button type='primary' size='small' ghost>版本管理</a-button>
            ];
          }
        }
      ])
    };
  },
  computed: {
    ...mapState('eventCodeMaintenance', [
      'eventMaintenanceList',
      'eventMaintenanceLoading',
      'addEventMaintenanceLoading',
      'paginationOptions',
      'getStandScoreListLoading',
      'standScoreList',
      'standScoreUpdateLoading',
      'uploadLoading',
      'upload2Data',
      'upload2Loading'
    ]),
    ...mapGetters('user', ['userInfo']),
    standScoreListF() {
      return [...this.standScoreList].sort((a, b) => a.priority - b.priority);
    },
    ...mapGetters('setting', ['sideMenuWidth'])
  },
  watch: {
    addVisible(nv) {
      if (!this.addVisible) {
        this.cancelHandler();
      }
    }
  },
  mounted() {
    this.changeTable({ current: 1 });
  },
  created(){
    getRingstoneList().then(res=>{
            if(res.code ===200){
              this.ringstoneList = res.data
            }
          })
  },
  methods: {
    ...mapMutations('eventCodeMaintenance', ['setState']),

    ...mapActions('eventCodeMaintenance', [
      'getEventMaintenance',
      'addEventMaintenance',
      'delEventMaintenance',
      'standScoreUpdate',
      'getStandScoreList',
      'uploadFile',
      'updateEventCode',
      'removeFile',
      'uploadEventMaintenance'
    ]),
    onChange(e, i) {
      console.log(e, i);
      this.standScoreListF[i]['silence'] = e.target.checked ? '1' : '0';
    },
    changeTable({ current, pageSize = 10 }) {
      if (pageSize !== this.paginationOptions.pageSize) {
        current = 1;
      }
      this.setState({
        key: 'paginationOptions',
        payload: { ...this.paginationOptions, pageNum: current, pageSize }
      });
      this.getData();
    },
    addConfirmHandler() {
      this.$refs.addForm.validate((valid) => {
        if (valid) {
          const params = {
            ...this.addForm
          };
          this.addForm.partNumber
            ? (params['partNumber'] = this.addForm.partNumber
              .replace(/,/, '，')
              .split('，'))
            : (params['partNumber'] = []);
          this.upload2Data.length >= 0
            ? (params['files'] = [...this.upload2Data])
            : '';
          if (this.addForm.id) {
            this.updateEventCode(params).then((rep) => {
              if (rep) {
                this.addVisible = false;
                this.cancelHandler();
                this.getData();
              }
            });
          } else {
            this.addEventMaintenance(params).then((rep) => {
              if (rep) {
                this.addVisible = false;
                this.cancelHandler();
                this.changeTable({ current: 1 });
              }
            });
          }
        } else {
          return false;
        }
      });
    },
    beforeUpload2(file) {
      this.fileList2 = [file];
      const { fileList2 } = this;
      const formData = new FormData();
      fileList2.forEach((file) => {
        formData.append('file', file);
      });
      const params = {
        formData
      };
      this.addForm.code ? (params.code = this.addForm.code) : '';
      this.uploadEventMaintenance(params);
      return false;
    },
    delFileItemHandler(item, index) {
      this.removeFile({ fileName: item.url }).then((res) => {
        if (res) {
          const u = [...this.upload2Data];
          u.splice(index, 1);
          this.setState({ key: 'upload2Data', payload: u });
          this.changeTable({ current: this.paginationOptions.pageNum });
        }
      });
    },
    beforeUpload(file) {
      this.fileList = [file];
      const { fileList } = this;
      const formData = new FormData();
      fileList.forEach((file) => {
        formData.append('file', file);
      });
      this.uploadFile(formData);
      return false;
    },
    cancelHandler() {
      this.addForm = {
        isEtops: 0,
        otherItem: 0
      };
      this.addTitle = '新增新的事件代码';
      this.$refs.addForm?.resetFields();
      this.setState({ key: 'upload2Data', payload: [] });
    },
    // 详情
    detailEventHandler(row) {
      this.addVisible = true;
      this.addForm = { ...row };
      this.setState({ key: 'upload2Data', payload: row?.files ?? [] });
      this.addForm.partNumber = (this.addForm.partNumber ?? []).join();
      this.addTitle = '修改事件代码';
    },
    // 确认删除
    delItemHandler(id) {
      this.delEventMaintenance({ id }).then((rep) => {
        if (rep) {
          this.getData();
        }
      });
    },
    // 筛选弹框
    handleClickChange(visible) {
      console.log(visible);
      if (visible) {
        this.getStandScoreList();
      }

      this.standScoreVisiable = !!visible;
    },
    // 全局维护
    changeStandScoreList(v, index) {
      if (index === 1) {
        if (
          v < this.standScoreListF?.[index + 1]?.score &&
          v > this.standScoreListF?.[index - 1]?.score
        ) {
          this.standScoreListF[index].score = v;
        }
      } else if (index === 0) {
        if (v < this.standScoreListF?.[index + 1]?.score && v >= 0) {
          this.standScoreListF[index].score = v;
        }
      } else if (index === 2) {
        if (v > this.standScoreListF?.[index - 1]?.score) {
          this.standScoreListF[index].score = v;
        }
      }
    },
    // 保存全局维护
    standScoreSave() {
      this.standScoreUpdate({
       userId:this.userInfo.userId,
       scoreData: this.standScoreList,
       scoreType:0+''
      }).then(res => {

        if (res) {
          this.standScoreVisiable = false;
        }
      });
    },
    // 重置
    resetSearchHandler() {
      this.search = {};
      this.changeTable({ current: 1 });
    },

    getData() {
      for (const key in this.search) {
        if (Object.hasOwnProperty.call(this.search, key)) {
          const element = this.search[key];
          if (!element || element.length === 0) {
            delete this.search[key];
          }
        }
      }
      this.getEventMaintenance(this.search);
    }
  }
};
</script>

<style lang="less">
.ecm-qj-item-0 {
  order: 3;
}
.ecm-qj-item-1 {
  order: 2;
}
.ecm-qj-item-2 {
  order: 1;
}
.ecm-qj-item-iput {
  width: 160px;
  margin-left: 50px;
}

.event-code-maintenance {
  .ant-table-tbody > tr > td {
    border-bottom: unset;
    height: 48px;
  }
  .ant-table-row-cell-break-word {
    padding: 0 !important;
  }
}
.event-code-maintenance .comm-search-f .ecm-search-item {
  flex: 1 !important;
  width: 180px !important;
  max-width: 200px !important;
}
.uload2-out-box {
  .ant-form-item-children {
    display: flex !important;
    flex-direction: column;
  }
}
</style>
